package cc;

import java.util.ArrayList;
import java.util.List;

//泛型类
public class BlockStorage<T extends Block> {
    private List<T> blocks;

    //初始化的时候创建一个方法
    public BlockStorage() {
        blocks = new ArrayList<T>();
    }

    //装东西
    public void addBlock(T block) {
        blocks.add(block);
        System.out.println("Added block: " + block);
    }

    //看看有些什么
    public void displayStorage(){
        System.out.println("Displaying storage of blocks: ");
        for(T block : blocks){
            System.out.println(block);
        }
    }

}
